<?php
/* See
      http://themeshaper.com/blog/functions-php-wordpress-child-themes/
   and 
      http://icfun.blogspot.com/2008/07/php-how-to-check-useragent.html
   for more */

function childtheme_iefix() { 

    if(isset($_SERVER['HTTP_USER_AGENT'])){
        $agent = $_SERVER['HTTP_USER_AGENT'];
        if(strstr($agent,'MSIE')){
            ?>
            <link rel="stylesheet" type="text/css" href="<?php echo bloginfo('stylesheet_directory') ?>/ie.css" />
            <?php
        }
    } 
 
}

function childtheme_specialcss() { 
	/* This is to provide over-ride CSS which is date/time specific, note, will over-ride MSIE sheet */
	?><link rel="stylesheet" type="text/css" href="<?php echo bloginfo('stylesheet_directory') ?>/specialdates.css" />
<?php }
 


function childtheme_variantcss() {
    // Pre-2.6 compatibility
    if ( !defined('WP_CONTENT_URL') )
        define( 'WP_CONTENT_URL', get_option('siteurl') . '/wp-content');
    if ( !defined('WP_CONTENT_DIR') )
        define( 'WP_CONTENT_DIR', ABSPATH . 'wp-content' );
    
    // Guess the location
    $variantcss_path = WP_CONTENT_DIR.'/themes/murkymatic/variant.css';
    $variantcss_url = WP_CONTENT_URL.'/themes/murkymatic/variant.css';

    if (file_exists($variantcss_path)) { ?>   
        <!-- Custom CSS -->
    	<link rel="stylesheet" type="text/css" href="<?php bloginfo('wpurl'); ?>/wp-content/themes/murkymatic/variant.css" />      	
    	
    <?php } elseif (file_exists($variantcss_url)) { ?>   
        <!-- Custom CSS -->
    	<link rel="stylesheet" type="text/css" href="<?php bloginfo('wpurl'); ?>/wp-content/themes/murkymatic/variant.css" />
    <?php } else { ?> <!-- Create the file variant.css in the murkymatic directory to customise things --> <?php }	
} 



// custom login for theme
function childtheme_custom_login() {
	echo '<link rel="stylesheet" type="text/css" href="' . get_bloginfo('stylesheet_directory') . '/customlogin.css" />';
}

function childtheme_custom_loginmessage() {
	echo '<p class="murkymaticmessage"><a href="http://www.murky.org/blg/murkymatic/">Murkymatic</a> is a <a href="http://themeshaper.com/blog/functions-php-wordpress-child-themes/">Child Theme</a> in the <a href="http://themeshaper.com/thematic-for-wordpress/">Thematic Framework</a></p>';
}

add_action('login_form', 'childtheme_custom_loginmessage'); 
add_action('login_head', 'childtheme_custom_login');
add_action('wp_head', 'childtheme_iefix');
add_action('wp_head', 'childtheme_specialcss');
add_action('wp_head', 'childtheme_variantcss');

?>